(function(){
   Ext.onReady(function() {
   	var resultsPanel = Ext.create('Ext.panel.Panel', {
    border: false,
    width: 400,
    id:'two',
    height: 250,
    frame:true,
    bodyBorder:false,
    renderTo: Ext.getBody(),
    bodyStyle:{
				    background:'#ffc url(image/xiao.jpg)'
				  
				    },
    
    items: [{
    		   xtype: 'form',// Results grid specified as a config object with an xtype of 'grid'
			   renderTo: Ext.getBody(),
				    //style:'margin-top:10px',
//			   bodyPadding: 10,
			   bodyBorder:false,
//			   frame:true,
			   width: 390,
			   height:240,
			   id:'one',
		       bodyStyle:{
			   background:'#ffc url(image/xiao.jpg)'
				  
				    },
				    method : "post",
				    			    items: [{
				        xtype: 'textfield',
				        // style:'margin-top:10px',
				         margin:'30,0,0,0',
//				       <LI class=user_main_text></LI>
				        fieldLabel: '用户名<font color="red">*</font> ',
				        name: 'name',
				       listeners : {  
                   specialkey : function(field, e) {  
                 if (e.getKey() == Ext.EventObject.ENTER) {  
                     
                   // alert("键盘事件");
                     Ext.getCmp('one').getForm().submit(  
                            {  
                                success : function(  form, action)    
                                       
                                       {  
                                      
                                  
                                       document.location='main.jsp';
                                },  
                                url: 'login.action',  
                                waitMsg : '正在提交，请稍等...'  
                            })  
        }  
    }  
},
	
				        allowBlank: false

				    },
				        {
				        xtype: 'textfield',
				         //style:'margin-top:10px',
				         margin:'30,0,0,0',
				        fieldLabel: '密码<font color="red">*</font>',
				        inputType: 'password',
				        name: 'password',
				        listeners : {  
                   specialkey : function(field, e) {  
                 if (e.getKey() == Ext.EventObject.ENTER) {  
                     
                      Ext.getCmp('one').getForm().submit(  
                            {  
                                success : function(  form, action)    
                                       
                                       {  
                                       document.location='main.jsp';
                                },  
                                url: 'login.action',  
                                waitMsg : '正在提交，请稍等...'  
                            })  
        }  
    }  
}
	
				    }],
				
				    buttons: [{
				        text:'登陆系统',
				        //'<LI class=user_main_r><INPUT class=IbtnEnterCssClass id=IbtnEnter  type=image src="images/user_botton.gif" name=IbtnEnter> </LI> ',
                           
				        //'登陆系统',
				        handler: function() {
				            var form = this.up('form').getForm();
				            if (form.isValid()) {
			
				                form.submit({
				                	url: 'login.action',
				                    success: function(form, action) {    
//				                    Ext.Msg.alert('登陆成功', action.result.message);	
				                     document.location='main.jsp';
				                    },
				                    failure: function(form, action) {
				                    Ext.Msg.alert('登陆失败', "密码或用户名不正确！");
								   }
									   
							  });
				            }
				        }
				    },{
				      text: '重新设置',
				       handler: function() {
				       	this.up('form').getForm().reset();
				       }
				    }]
	  
                                              // Use 1/3 of Container's height (hint to Box layout)
    }]
});
Ext.getCmp('two').setPosition(800, 230);  
	});	
	
})();
	